<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:c="livcos.org/ns/cosmos"
  xmlns:u="livcos.org/ns/cosmos/update"
  xmlns:t="livcos.org/ns/cosmos/type"
  xmlns:job="livcos.org/ns/process/job"
  xmlns="livcos.org/ns/doc"
  xmlns:doc="livcos.org/ns/doc"
  xmlns:f="livcos.org/ns/xslt/function"
  exclude-result-prefixes="c t doc f">

  <xsl:import href="../../common/base.xsl" />
  
  <xsl:param name="job"/>
  <xsl:param name="view"/>
	
  <xsl:template match="/">
    <job:transform def="{$job}">
    	<xsl:apply-templates select="$jobObject/c:request/parameter/group"/>
    </job:transform>
  	<xsl:variable name="pChar" select="if (contains($view, '?')) then '&amp;' else '?'"/>
  	<xsl:variable name="caller" select="f:extract-object-id($view)"/>
  	<xsl:variable name="sys" select="f:find-object('/', $caller, 'sys/resolver')"/>
  	<xsl:variable name="viewObj" select="substring($sys, 0, string-length($sys) - 12)"/>
  	<job:resolve uri="{$view}{$pChar}callerObjId={$caller}&amp;viewObjId={$viewObj}"/>
  </xsl:template>
	
	<xsl:template match="group">
		<param name="{name}" value="{value}"/>
	</xsl:template>
  
</xsl:stylesheet>
